<template>
  <input type="text" :value="$store.state.search" @input="onChange"/>
  <span>城市: {{$store.getters.searchText}}</span>
</template>
<script>
export default {
  methods: {
    onChange(e) {
      this.$store.commit('setSearch', e.target.value)
      this.$store.dispatch('getWeather', e.target.value)
    }
  }
}
</script>